package com.face.client.model;

import com.arcsoft.AFR_FSDK_FACEMODEL;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

//@Document(collection = "testModel")
public class FaceTestModel implements BaseFeature {

    @Id
    private String id;

    private String imageName;

    private String fileId;

    private byte[] content; // 特征向量

    private int size;

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getImageName() {
        return imageName;
    }

    public void setImageName(String imageName) {
        this.imageName = imageName;
    }

    public String getFileId() {
        return fileId;
    }

    public void setFileId(String fileId) {
        this.fileId = fileId;
    }

    public byte[] getContent() {
        return content;
    }

    public void setContent(byte[] content) {
        this.content = content;
    }

    public static FaceTestModel build(int size, byte[] bytes) {
        FaceTestModel faceTestModel = new FaceTestModel();
        faceTestModel.content = bytes;
        faceTestModel.size = size;
        return faceTestModel;
    }

    public AFR_FSDK_FACEMODEL toModel() {
        return AFR_FSDK_FACEMODEL.build(size, content);
    }

    @Override
    public String toString() {
        return "FaceTestModel{" +
                "id='" + id + '\'' +
                ", imageName='" + imageName + '\'' +
                ", fileId='" + fileId + '\'' +
                ", size=" + size +
                '}';
    }
}
